/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#include "StdAfx.h"
#include "DialogBoxView.h"

#include "../shared/StringUtil.h"
#include "../gui/GUI_Manager.h"

DialogBoxView::DialogBoxView(void)
{
    //m_box   = NULL;
    //m_box   = MDialogBox::GetInstance();
    //m_frame = NULL;

    //m_width   =    600;
    //m_height  =    300;

    //m_location.x = 100;
    //m_location.y = 200;
}

DialogBoxView::~DialogBoxView(void)
{
}


/** Update any animations */
void DialogBoxView::Update(long dt)
{
   // gui::GUI_Manager::GetInstance()->Update( dt );
}
/** Render the dialog box */
void DialogBoxView::Render( IRender *r, ICamera* cam  )
{
   // gui::GUI_Manager::GetInstance()->Render( r );
    //r->DrawImage( m_frame, m_location.x, m_location.y, m_width, m_height );


        // set the background color
    //r->SetColor( 0.2f, 0.5f, 0.7f, 0.6f );
    ////r->SetColor( m_bColor.GetX(), m_bColor.GetY(), m_bColor.GetZ(), GetAlpha() );
    //r->FillRect( m_location.x, m_location.y, m_width, m_height );

    //// draw a trim
    //r->SetColor( 0 , 0 , 0 );
    //r->DrawRect( m_location.x, m_location.y, m_width, m_height );

    //r->SetColor( 0.16f, 0.16f, 0.14f );
    //r->FillRect( m_location.x, m_location.y, m_width, m_height - (m_height + 15) );
    //r->SetColor( 0, 0, 0 );
    //// always draw a header
    //r->DrawRect( m_location.x, m_location.y, m_width, m_height - (m_height + 15) );
    //r->SetColor( 1, 1, 1 );
    //r->DrawString( m_location.x, m_location.y - 15, "DialogBox" );

    ////
    //r->SetColor( 0.2f, 0.5f, 0.7f, 0.6f );
    //r->FillRect( m_location.x, m_location.y, m_width, m_height );    
    //r->SetColor( 0 , 0 , 0 );
    //r->DrawRect( m_location.x, m_location.y, m_width, m_height );
    //r->DrawString( m_location.x, m_location.y + 20, m_box->GetText().c_str() );
    //
    //if ( !m_box->GetResponses() ) return;
    //// draw the response options
    //r->SetColor( 0 , 0 , 0 );
    //r->FillRect( m_location.x, m_location.y + m_height - 30 , m_width, 2 );
    //std::string str;
    //int pos = 0;
    //for ( int i = 0;i < m_box->GetResponses()->size; i++ )
    //{   str = m_box->GetResponses()->m_responsePossibilites[i].response;
    //    pos += i*13*str.length() + 15;
    //    r->DrawString( m_location.x + pos, m_location.y + m_height - 20, str.c_str() );
    //}
    //if ( !str.empty() )
    //{
    //    r->SetColor( 1, 0.8, 0.7 );
    //    r->FillCircle( 5, m_location.x + m_box->GetIndex()*13*str.length() + 8, m_location.y + m_height - 12 );
    //}
    

}

///** Format the text box */
//void DialogBoxView::Format(int charWidth)
//{
//    int length;
//
//    std::string txt = m_box->GetText();
//    
//    StringUtil util(txt);
//    for( int i = 0; i < util.Size(); i++ )
//    {
//        
//    }
//    length = charWidth * txt.length();
//    
//}